var cliImg = '';
var cliImgSrc = '';
var n = Math.round(Math.random() * 10);
var cx = slideimages.length;
var interval = 5000;
var setTimeId = '';

var numimg = new Array;
numimg[0]="img/s_1.jpg";
numimg[1]="img/s_2.jpg";
numimg[2]="img/s_3.jpg";
numimg[3]="img/s_4.jpg";
numimg[4]="img/s_5.jpg";

function rotateStop()
{
	clearTimeout(setTimeId);
}

function rotateStart()
{
	rotate();
}


function chki(no)
{
	var pImg = document.getElementById("slide");
	//var pUrl = document.getElementById("RollUrl");
	var pTitle = document.getElementById("textslide");
	var ci = document.getElementById("xiaosan").getElementsByTagName("img");
	if(cliImg == '')
	{
	   cliImg = ci[no];
	   cliImgSrc = ci.src[no];
	   ci.src[no] = numimg[no];
	   n=no;
	   pImg.src = slideimages[no];
	   //pUrl.href = slidelinks[no];  
	   pTitle.innerText = slidetext[no];  
	}
	else if(cliImg != ci)
	{
	   cliImg.src = cliImgSrc;
	   cliImg = ci[no];
	   cliImgSrc = ci[no].src;
	   ci[no].src = numimg[no];
	   n=no;
	   pImg.src = slideimages[no];
	   //pUrl.href = slidelinks[no];  
	   pTitle.innerText = slidetext[no];  
	}
}

function rotate()
{
	n = (n >= cx-1) ? 0 : n+1;
	setimgurl();
	setTimeId=setTimeout("rotate()",interval);
}

function setimgurl(numt)
{
	var xx = document.getElementById("xiaosan").getElementsByTagName("img");
	var ci = xx[n];
	document.getElementById("slide").filters.blendTrans.apply();
	//document.getElementById("RollUrl").href=slidelinks[n];
	document.getElementById("slide").src=slideimages[n];
	document.getElementById("textslide").innerText=slidetext[n];
	document.getElementById("slide").filters.blendTrans.play();
	if(cliImg == '')
	{
	   cliImg = ci;
	   cliImgSrc = ci.src;
	   ci.src = numimg[n];
	}
	else if(cliImg != ci)
	{
	   cliImg.src = cliImgSrc;
	   cliImg = ci;
	   cliImgSrc = ci.src;
	   ci.src = numimg[n];
	}
}

function gotoshow()
{
	window.open(slidelinks[n]);
}
